"""
Definition of forms.
"""

from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy as _


class BootstrapAuthenticationForm(AuthenticationForm):
    """Authentication form which uses boostrap CSS."""
    username = forms.CharField(max_length=254,
                               widget=forms.TextInput({
                                   'class': 'form-control',
                                   'placeholder': 'User name'}))
    password = forms.CharField(label=_("Password"),
                               widget=forms.PasswordInput({
                                   'class': 'form-control',
                                   'placeholder': 'Password'}))


class SubmissionForm(forms.Form):
    problem_id = forms.IntegerField()
    code = forms.CharField()


class DiscussForm(forms.Form):
    problem_id = forms.IntegerField()
    content = forms.CharField()


class ProblemSearchForm(forms.Form):
    search_type = forms.CharField(initial='title', required=False, )
    search_key = forms.CharField(initial='', required=False, )
    tag = forms.IntegerField(initial=0, required=False, )
    difficulty = forms.IntegerField(initial=0, required=False, )
    page = forms.IntegerField(initial=0, required=False, )
